var t,
  a,
  e = require("../../@babel/runtime/helpers/defineProperty"),
  i = require("../../res/www.a9a.cn.js"),
  n = 2,
  r = 2,
  s = !0,
  d = getApp(),
  o = wx.getStorageSync("COOK_U");
Page({
  data: {
    color: d._ZEAI.color,
    rgbcolor: d._ZEAI.rgbcolor,
    topbar: ["推荐", "动态"],
    currentTab: 0,
    ARR_index_nodata: !1,
    ARR_trend_nodata: !1,
    triggered: !0,
    loading_flag: !1,
    loading_ico_flag: !1,
    loading_str: "拼命加载中",
    backtop_flag_index: !1,
    triggered2: !0,
    marquee_flag: !0,
  },
  marqueeFn: function () {
    this.setData({ marquee_flag: !1 });
  },
  topbarFn: function (t) {
    this.setData({ currentTab: t.currentTarget.dataset.idx });
  },
  swiperChange: function (t) {
    this.setData({ currentTab: t.detail.current });
  },
  setloading: function (t, a) {
    "start" == t
      ? this.setData({ loading_flag: !0, loading_ico_flag: !0, loading_str: a })
      : this.setData({
          loading_flag: !1,
          loading_ico_flag: !1,
          loading_str: a,
        });
  },
  trend_tab2Fn: function (t) {
    var e = t.currentTarget.dataset.t;
    (a = { t: e }), this.trend_init();
  },
  trend_init: function () {
    var t = this;
    wx.showLoading({ title: "拼命加载中...", mask: !0 }), (s = !1);
    var n = {
      submitok: "trend",
      openid: (o = wx.getStorageSync("COOK_U")).openid,
    };
    i.empty(a) ||
      (n = JSON.parse(
        (JSON.stringify(n) + JSON.stringify(a)).replace(/}{/, ",")
      )),
      d.ajax({
        url: "trend.php",
        data: n,
        success: function (a) {
          var i;
          1 == a.flag
            ? 0 == a.LIST.length
              ? t.setData({
                  ARR_trend: [],
                  trendSO: a.SO,
                  ARR_trend_nodata: !0,
                })
              : t.setData(
                  (e((i = {}), "ARR_trend[0]", a.LIST),
                  e(i, "trendSO", a.SO),
                  i)
                )
            : wx.showToast({ title: a.msg, icon: "none", mask: !0 });
          (s = !0), wx.hideLoading();
        },
      });
  },
  trend_topFn: function (t) {
    var a = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        a.setData({ triggered2: !1, ARR_trend: [] }),
          a.setloading("end", "拼命加载中"),
          (r = 2),
          a.trend_init();
      }, 500);
  },
  trend_btmFn: function (t) {
    var n = this.data.ARR_trend,
      c = this;
    if (s) {
      (s = !1), c.setloading("start", "拼命加载中");
      var u = { submitok: "trend", p2: r, openid: o.openid };
      i.empty(a) ||
        (u = JSON.parse(
          (JSON.stringify(u) + JSON.stringify(a)).replace(/}{/, ",")
        )),
        d.ajax({
          url: "trend.php",
          data: u,
          success: function (t) {
            if (1 == t.flag) {
              var a = n.length;
              if (t.LIST.length < 1)
                return c.setloading("end", "已全部加载完毕"), void (s = !1);
              c.setData(e({}, "ARR_trend[" + a + "]", t.LIST)), (r += 1);
            } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
            c.setloading("end", "上拉加载更多"), (s = !0);
          },
        });
    }
  },
  gzFn: function (t) {
    var a = this,
      n = t.currentTarget.dataset.idx,
      r = t.currentTarget.dataset.idx2,
      s = t.currentTarget.dataset.uid;
    d.chklogin().then(function (t) {
      t
        ? ((o = wx.getStorageSync("COOK_U")),
          d.ajax({
            url: "u.php",
            data: { submitok: "ajax_gz", uid: s, openid: o.openid },
            success: function (t) {
              1 == t.flag
                ? (a.setData(
                    e({}, "ARR_trend[" + n + "][" + r + "].gzclass", t.gzclass)
                  ),
                  wx.showToast({ title: t.msg, icon: "none", mask: !0 }))
                : ((t.this = a), (t.url = "no"), i.sorry(t));
            },
          }))
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  agreeFn: function (t) {
    var a = this,
      n = t.currentTarget.dataset.idx,
      r = t.currentTarget.dataset.idx2,
      s = t.currentTarget.dataset.id;
    d.chklogin().then(function (t) {
      t
        ? ((o = wx.getStorageSync("COOK_U")),
          d.ajax({
            url: "trend.php",
            data: { submitok: "ajax_agree", tid: s, openid: o.openid },
            success: function (t) {
              if (1 == t.flag) {
                var s,
                  d = a.data.ARR_trend[n][r].agree_arr.length;
                a.setData(
                  (e(
                    (s = {}),
                    "ARR_trend[" + n + "][" + r + "].agreefly",
                    "block"
                  ),
                  e(s, "ARR_trend[" + n + "][" + r + "].agree_arr[" + d + "]", {
                    uid: t.uid,
                    photo_s: t.photo_s,
                  }),
                  s)
                );
              } else (t.this = a), (t.url = "no"), i.sorry(t);
            },
          }))
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  bbsFn: function (t) {
    var a = this,
      e = t.currentTarget.dataset.idx,
      i = t.currentTarget.dataset.idx2,
      n = t.currentTarget.dataset.id;
    this.setData({
      bbsFormFlag: !0,
      bbs_content: "",
      bbs_form_id: n,
      bbs_form_idx: e,
      bbs_form_idx2: i,
    }),
      setTimeout(function () {
        a.setData({ bbs_content_focus: !0 });
      }, 500);
  },
  bbsFormMaskFn: function () {
    this.setData({ bbsFormFlag: !1, bbs_content_focus: !1 });
  },
  bbs_submitFn: function (t) {
    var a = this;
    d.chklogin().then(function (n) {
      n
        ? wx.showModal({
            title: "温馨提醒",
            content:
              "确定提交么？\n以下情形话题将被删除或封号：\n1．请勿留下任何形式联系方法\n2．请勿发表涉黄涉政相关言论\n3．请勿发表辱骂攻击他人言论",
            confirmColor: a.data.color,
            cancelText: "取消",
            confirmText: "确定",
            success: function (n) {
              if (n.confirm) {
                var r = t.currentTarget.dataset.idx,
                  s = t.currentTarget.dataset.idx2,
                  c = t.currentTarget.dataset.id,
                  u = t.detail.value.bbs_content;
                (o = wx.getStorageSync("COOK_U")),
                  d.ajax({
                    url: "trend.php",
                    data: {
                      submitok: "bbs_add",
                      fid: c,
                      content: u,
                      openid: o.openid,
                    },
                    success: function (t) {
                      if (1 == t.flag) {
                        var n,
                          d = a.data.ARR_trend[r][s].bbs_arr.length;
                        a.setData(
                          (e(
                            (n = {}),
                            "ARR_trend[" + r + "][" + s + "].bbs_class",
                            t.ARR.bbs_class
                          ),
                          e(
                            n,
                            "ARR_trend[" +
                              r +
                              "][" +
                              s +
                              "].bbs_arr[" +
                              d +
                              "]",
                            t.ARR.bbs_arr
                          ),
                          e(n, "bbsFormFlag", !1),
                          e(n, "bbs_content_focus", !1),
                          n)
                        );
                      } else (t.this = a), (t.url = "no"), i.sorry(t);
                    },
                  });
              }
            },
          })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  zoom9Fn: function (t) {
    var a = t.currentTarget.dataset.cur,
      e = t.currentTarget.dataset.idx,
      n = t.currentTarget.dataset.idx2;
    i.empty(a) ||
      wx.previewImage({ current: a, urls: this.data.ARR_trend[e][n].pic_arr });
  },
  trend_addFn: function () {
    d.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../trend/trend?t=add" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  trend_soFn: function () {
    this.setData({
      div_right_mask_class: "alpha0_100",
      div_right_box_class: "div_leftAnm1",
      div_right_flag: !0,
    });
  },
  div_right_close_Fn: function () {
    var t = this;
    this.setData({
      div_right_mask_class: "alpha100_0",
      div_right_box_class: "div_leftAnm2",
    }),
      setTimeout(function () {
        t.setData({ div_right_flag: !1 });
      }, 500);
  },
  div_right_boxFn: function () {},
  trend_form_uid_submitFn: function (t) {
    var e = t.detail.value.keyword;
    (a = { keyword: e }), this.div_right_close_Fn(), this.trend_init();
  },
  trend_input_uid_submitFn: function (t) {
    var e = t.detail.value;
    (a = { keyword: e }), this.div_right_close_Fn(), this.trend_init();
  },
  trend_form_ext_liFn: function (t) {
    var a,
      n = t.currentTarget.dataset.idx,
      r = t.currentTarget.dataset.v,
      s = t.currentTarget.dataset.fkind,
      d = this.data.trendSO[n].v;
    (a = i.empty(d)
      ? r
      : "checkbox" == s
      ? i.indexOf(d, r)
        ? (a = i.json_remove(d, r)).join(",")
        : d + "," + r
      : r),
      0 == r && (a = 0),
      this.setData(e({}, "trendSO[" + n + "].v", a));
  },
  trend_form_ext_submitFn: function (t) {
    (a = t.detail.value), this.div_right_close_Fn(), this.trend_init();
  },
  trend_form_ext_resetFn: function (t) {
    var a = this.data.trendSO;
    for (var i in a) this.setData(e({}, "trendSO[" + i + "].v", 0));
    this.setData({ keyword: "" });
  },
  onLoad: function (t) {
    wx.switchTab({ url: "index4" });
  },
  init: function () {
    var a = this;
    wx.showLoading({ title: "拼命加载中...", mask: !0 }), (s = !1);
    var n = {
      submitok: "index",
      openid: (o = wx.getStorageSync("COOK_U")).openid,
    };
    i.empty(t) ||
      (n = JSON.parse(
        (JSON.stringify(n) + JSON.stringify(t)).replace(/}{/, ",")
      )),
      d.ajax({
        url: "index.php",
        data: n,
        success: function (t) {
          if (1 == t.flag) {
            var n;
            if (0 == t.LIST.length || i.empty(t.LIST))
              a.setData({
                marquee: t.marquee,
                SHARE: t.SHARE,
                ARR_index: t.LIST,
                ARR_index_nodata: !0,
                pxSO: t.pxSO,
                SO: t.SO,
                areaidARR: t.areaidARR,
                area2idARR: t.area2idARR,
              });
            else
              a.setData(
                ((n = { marquee: t.marquee, SHARE: t.SHARE }),
                e(n, "ARR_index[0]", t.LIST),
                e(n, "ARR_index_nodata", !1),
                e(n, "pxSO", t.pxSO),
                e(n, "SO", t.SO),
                e(n, "areaidARR", t.areaidARR),
                e(n, "area2idARR", t.area2idARR),
                n)
              );
            var r = i.get_tabbar_index("my_msg");
            t.btmnewnum > 0
              ? wx.setTabBarBadge({ index: r, text: t.btmnewnum })
              : wx.removeTabBarBadge({ index: r });
          } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
          wx.hideLoading(), (s = !0);
        },
      });
  },
  upFn: function (t) {
    var a = this;
    wx.vibrateShort({ type: "heavy" }),
      setTimeout(function () {
        a.setData({
          triggered: !1,
          loading_flag: !1,
          loading_str: "拼命加载中",
          ARR_index: [],
          ARR_index_nodata: !1,
        }),
          (n = 2),
          a.init();
      }, 500);
  },
  btmFn: function (a) {
    var r = this.data.ARR_index,
      c = this;
    if (s) {
      (s = !1), c.setloading("start", "拼命加载中");
      var u = { submitok: "index", p: n, openid: o.openid };
      i.empty(t) ||
        (u = JSON.parse(
          (JSON.stringify(u) + JSON.stringify(t)).replace(/}{/, ",")
        )),
        d.ajax({
          url: "index.php",
          data: u,
          success: function (t) {
            if (1 == t.flag) {
              var a = r.length;
              if (t.LIST.length < 1)
                return c.setloading("end", "已全部加载完毕"), void (s = !1);
              c.setData(e({}, "ARR_index[" + a + "]", t.LIST)),
                (n += 1),
                (s = !0);
            } else wx.showToast({ title: t.msg, icon: "none", mask: !0 });
            c.setloading("end", "上拉加载更多");
          },
        });
    }
  },
  backtopFn: function (t) {
    var a = "scrolltopNum_" + t.currentTarget.dataset.id;
    this.setData(e({}, a, 0));
  },
  binnd_scroll_index: function (t) {
    t.detail.scrollTop > 100
      ? this.setData({ backtop_flag_index: !0 })
      : this.setData({ backtop_flag_index: !1 });
  },
  bind_dl: function (t) {
    var a = t.currentTarget.dataset.uid;
    wx.navigateTo({ url: "../u/u?uid=" + a });
  },
  pxFn: function () {
    var t, a;
    "ed" == this.data.pxclass ? ((a = !1), (t = "")) : ((t = "ed"), (a = !0)),
      this.setData({ pxclass: t, sobox: a });
  },
  souboxFn: function (a) {
    var e = a.currentTarget.dataset.sokind;
    (t = { sokind: e }), this.setData({ sokind: e }), this.init();
  },
  px_ageFn: function (a) {
    var n = a.detail.value;
    if (n[0] > n[1])
      return wx.showToast({ title: "必须左小右大哦", icon: "none" }), !1;
    var r = this.data.pxSO.age.arr[0],
      s = i.idx_iv(n, r),
      d = s[0],
      o = (s[1], d.split(","));
    this.setData(e({}, "pxSO.age.def", o)),
      (t = { sokind: "ext", age: d }),
      this.init();
  },
  px_heighFn: function (a) {
    var n = a.detail.value;
    if (n[0] > n[1])
      return wx.showToast({ title: "必须左小右大哦", icon: "none" }), !1;
    var r = this.data.pxSO.heigh.arr[0],
      s = i.idx_iv(n, r),
      d = s[0],
      o = (s[1], d.split(","));
    this.setData(e({}, "pxSO.heigh.def", o)),
      (t = { sokind: "ext", heigh: d }),
      this.init();
  },
  moreFn: function () {
    var t;
    (t = "ed" == this.data.somoreclass ? "" : "ed"),
      this.setData({
        index_so_flag: !0,
        index_so_mask_class: "alpha0_100",
        index_so_box_class: "div_leftAnm1",
        somoreclass: t,
      });
  },
  index_so_closeFn: function () {
    var t = this;
    this.setData({
      index_so_mask_class: "alpha100_0",
      index_so_box_class: "div_leftAnm2",
      somoreclass: "",
    }),
      setTimeout(function () {
        t.setData({ index_so_flag: !1 });
      }, 400);
  },
  rangFn: function (t) {
    t.currentTarget.dataset.f;
    var a,
      n = t.currentTarget.dataset.index,
      r = t.detail.value;
    if (r[0] > r[1])
      wx.showToast({ title: "请选择左小右大范围", icon: "none", mask: !0 });
    else {
      var s = i.idx_iv(r, this.data.SO[n].arr.arr[0]);
      this.setData(
        (e((a = {}), "SO[" + n + "].i", s[0]), e(a, "SO[" + n + "].v", s[1]), a)
      );
    }
  },
  index_SO_onoffFn: function (t) {
    var a,
      i = t.currentTarget.dataset.index;
    (a = "on" == this.data.SO[i].onoff ? "off" : "on"),
      this.setData(e({}, "SO[" + i + "].onoff", a));
  },
  index_SO_liFn: function (t) {
    if ("vip" != t.currentTarget.dataset.auth) {
      var a,
        n = t.currentTarget.dataset.idx,
        r = t.currentTarget.dataset.i,
        s = t.currentTarget.dataset.fkind,
        d = this.data.SO[n].i;
      (a = i.empty(d)
        ? r
        : "checkbox" == s
        ? i.indexOf(d, r)
          ? (a = i.json_remove(d, r)).join(",")
          : d + "," + r
        : r),
        0 == r && (a = 0),
        this.setData(e({}, "SO[" + n + "].i", a));
    } else this.vipFn();
  },
  index_SO_submitFn: function (a) {
    ((t = a.detail.value).keyword = this.data.keyword),
      this.index_so_closeFn(),
      this.init();
  },
  index_SO_resetFn: function (t) {
    var a = this.data.SO;
    for (var i in a) {
      var n;
      this.setData(
        (e((n = {}), "SO[" + i + "].i", 0), e(n, "SO[" + i + "].v", ""), n)
      );
    }
    this.setData({ keyword: "" });
  },
  vipFn: function () {
    d.chklogin().then(function (t) {
      t
        ? wx.navigateTo({ url: "../my_vip/my_vip" })
        : wx.navigateTo({ url: "../login/login" });
    });
  },
  areaidFn: function (t) {
    for (
      var a,
        n = t.currentTarget.dataset.kind,
        r = (t.currentTarget.dataset.f, t.detail.value),
        s = t.currentTarget.dataset.idx,
        d = [],
        o = 0;
      o < r.length;
      o++
    )
      r[o] > 0 && d.push(r[o] - 1);
    if (((r = d), "hj" == n)) var c = i.areaGetTtitle(r, this.data.area2idARR);
    else c = i.areaGetTtitle(r, this.data.areaidARR);
    var u = c[0],
      l = c[1];
    this.setData(
      (e((a = {}), "SO[" + s + "].i", u), e(a, "SO[" + s + "].v", l), a)
    );
  },
  areaidChangeFn: function (t) {
    var a,
      n = t.currentTarget.dataset.kind,
      r = t.detail.column,
      s = t.detail.value,
      d = t.currentTarget.dataset.idx,
      o = "hj" == n ? 4 : parseInt(this.data.SO[d].arealeval),
      c = { def: this.data.SO[d].arr.def, idx: this.data.SO[d].arr.idx };
    if ("hj" == n)
      var u = this.data.area2idARR.ARR1,
        l = this.data.area2idARR.ARR2,
        _ = this.data.area2idARR.ARR3,
        g = this.data.area2idARR.ARR4;
    else
      (u = this.data.areaidARR.ARR1),
        (l = this.data.areaidARR.ARR2),
        (_ = this.data.areaidARR.ARR3),
        (g = this.data.areaidARR.ARR4);
    var h,
      f,
      x,
      v = [{ i: "0", v: "不限", f: "0" }],
      p = u,
      R = [],
      b = [],
      m = [];
    switch (((p = v.concat(p)), r)) {
      case 0:
        if (0 == s)
          switch (
            ((c.def[0] = p),
            o >= 2 && (c.def[1] = v),
            o >= 3 && (c.def[2] = v),
            o >= 4 && (c.def[3] = v),
            o)
          ) {
            case 1:
              c.idx = [0];
              break;
            case 2:
              c.idx = [0, 0];
              break;
            case 3:
              c.idx = [0, 0, 0];
              break;
            case 4:
              c.idx = [0, 0, 0, 0];
          }
        else
          switch (((h = u[s - 1].i), o)) {
            case 1:
              (c.def = [p]), (c.idx = [s]);
              break;
            case 2:
              (R = v.concat(i.areaNEW(h, l))),
                (c.def = [p, R]),
                (c.idx = [s, 0]);
              break;
            case 3:
              (R = v.concat(i.areaNEW(h, l))),
                (c.def = [p, R, v]),
                (c.idx = [s, 0, 0]);
              break;
            case 4:
              (R = v.concat(i.areaNEW(h, l))),
                (c.def = [p, R, v, v]),
                (c.idx = [s, 0, 0, 0]);
          }
        break;
      case 1:
        if (0 == s)
          o >= 3 && (c.def[2] = v),
            o >= 4 && (c.def[3] = v),
            o >= 2 && (c.idx[1] = s),
            o >= 3 && (c.idx[2] = 0),
            o >= 4 && (c.idx[3] = 0);
        else
          switch (o) {
            case 2:
              c.idx[1] = s;
              break;
            case 3:
              (h = u[c.idx[0] - 1].i),
                (f = (R = v.concat(i.areaNEW(h, l)))[s].i),
                (b = v.concat(i.areaNEW(f, _))),
                (c.def[2] = b),
                (c.idx[1] = s),
                (c.idx[2] = 0);
              break;
            case 4:
              (h = u[c.idx[0] - 1].i),
                (f = (R = v.concat(i.areaNEW(h, l)))[s].i),
                (b = v.concat(i.areaNEW(f, _))),
                (c.def[2] = b),
                (c.def[3] = v),
                (c.idx[1] = s),
                (c.idx[2] = 0),
                (c.idx[3] = 0);
          }
        break;
      case 2:
        if (0 == s)
          o >= 4 && (c.def[3] = v),
            o >= 3 && (c.idx[2] = s),
            o >= 4 && (c.idx[3] = 0);
        else
          switch (o) {
            case 3:
              c.idx[2] = s;
              break;
            case 4:
              (h = u[c.idx[0] - 1].i),
                (f = (R = v.concat(i.areaNEW(h, l)))[c.idx[1]].i),
                (x = (b = v.concat(i.areaNEW(f, _)))[s].i),
                (m = v.concat(i.areaNEW(x, g))),
                (c.def[3] = m),
                (c.idx[2] = s),
                (c.idx[3] = 0);
          }
        break;
      case 3:
        o >= 4 && (c.idx[3] = s);
    }
    this.setData(
      (e((a = {}), "SO[" + d + "].arr.def", c.def),
      e(a, "SO[" + d + "].arr.idx", c.idx),
      a)
    );
  },
  index_SO_uid_submitFn: function (a) {
    (t = a.detail.value),
      this.setData({ keyword: t.keyword }),
      this.index_so_closeFn(),
      this.init();
  },
  index_SO_uid_submitFn2: function (a) {
    var e = a.detail.value;
    this.index_so_closeFn(),
      (t = { sokind: "keyword", keyword: e }),
      this.init();
  },
  index_SO_uid_bindblurFn: function (t) {
    var a = t.detail.value;
    this.setData({ keyword: a });
  },
  getPhoneNumber: function (t) {
    wx.login({
      success: function (a) {
        wx.request({
          url: d.WWW + "/api/wxxcx/get_openid.php",
          data: { code: a.code },
          success: function (a) {
            (a = i.jsoneval(a.data)),
              (o = wx.getStorageSync("COOK_U")),
              wx.request({
                url: d.WWW + "/api/wxxcx/get_mob.php",
                data: {
                  session_key: encodeURIComponent(a.U.session_key),
                  encryptedData: encodeURIComponent(t.detail.encryptedData),
                  iv: encodeURIComponent(t.detail.iv),
                  openid: a.U.openid,
                },
                success: function (t) {
                  (t = i.jsoneval(t.data)), wx.reLaunch({ url: "../my/my" });
                },
                fail: function (t) {
                  wx.showModal({ content: t, showCancel: !1 });
                },
              });
          },
        });
      },
    });
  },
  back: function () {
    this.setData({ div_login: !1 }), wx.navigateBack();
  },
  onShareAppMessage: function (t) {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      path: "/pages/index/index",
    };
  },
  onShareTimeline: function () {
    return {
      imageUrl: this.data.SHARE.imgurl,
      title: this.data.SHARE.title,
      query: "",
      path: "/pages/index/index",
    };
  },
  lawFn: function (t) {
    var a = t.currentTarget.dataset.kind;
    wx.navigateTo({ url: "/pages/about/law?kind=" + a });
  },
  emptyFn: function () {},
});
